package com.yss.ams.demo.service;

import com.yss.ams.demo.aop.DataSource;
import com.yss.ams.demo.aop.DataSourceNames;
import com.yss.ams.demo.mapper.UserMapper;
import com.yss.ams.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author shenyao
 * @date 2021/3/28
 * @description:
 */
@Service
public class DataSourceTestService {
    @Autowired
    UserMapper userMapper;


    public void testInsertUser(User user){
        int insertNum = userMapper.insert(user);
        System.out.println("插入成功,条数："+insertNum);
    }

    @DataSource(DataSourceNames.TWO)
    public void testInsertUser2(User user){
        int insertNum = userMapper.insert(user);
        System.out.println("插入成功,条数："+insertNum);
    }

}
